//Polymorphism should push_back pointer to container<Not reference!!!>
#include <iostream>
#include <vector>
using namespace std;

class Vehicle {
public:
  virtual void move(void) = 0;
  ~Vehicle(){cout<<"~Vehicle()"<<endl;}
};

class Car: public Vehicle {
public:
  void move(void) {cout<<"Car::move()"<<endl;}
  ~Car(){cout<<"~Car()"<<endl;}
};

class Rocket:public Vehicle {
public:
  void move(void) {cout<<"Rocket::move()"<<endl;}
  ~Rocket(){cout<<"~Rocket()"<<endl;}
};

class Ufo: public Vehicle{
public:
  void move(void) {cout<<"Ufo::move()"<<endl;}
  ~Ufo(){cout<<"~Ufo()"<<endl;}
};

int main(int argc, char *argv[]){



  Car c0;
  Rocket r0;
  Ufo u0;
  Vehicle& ve0 = c0;
  Vehicle& ve1 = r0;
  Vehicle& ve2 = u0;
  ve0.move();
  ve1.move();
  ve2.move();
  return 0;
}
